package com.cookmenu.daoimpl;

import java.util.List;

import android.content.Context;
import android.database.sqlite.SQLiteDatabase;

import com.cookmenu.dao.FoodNameDao;
import com.cookmenu.db.DBHelper;
import com.cookmenu.domain.FoodName;

public class FoodNameDaoImpl implements FoodNameDao {

	private DBHelper dbHelper;
	public FoodNameDaoImpl(Context context){
		dbHelper=new DBHelper(context);
	}
	
	public boolean insert(FoodName foodName) {
		SQLiteDatabase db=null;
		try{
			db=dbHelper.getWritableDatabase();
			String sqlInsert="insert into TABLE_FOODNAME(ID,FOODNAME) values (?,?)";
			db.execSQL(sqlInsert, new String[]{String.valueOf(foodName.getId()),foodName.getName()} );
			return true;
		}catch(Exception e){
			e.printStackTrace();
		}finally{
			if(db!=null){
				db.close();
			}
		}
		return true;
	}

	public boolean deleteAll(FoodName foodName) {
		
		return false;
	}

	@Override
	public List<FoodName> getAllFoodNames() {	 //娓呯┖琛�	
		return null;
	}

	@Override
	public boolean deleteAll() {
		// TODO Auto-generated method stub
		return false;
	}

}
